package com.zjk.controller;

import com.zjk.Result;
import com.zjk.category.CategoryBrandRelationEntity;
import com.zjk.service.CategoryBrandRelationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author: gfk
 * @create: 2022/10/20
 * @Description:
 * @FileName: CategoryBrandRelationController
 * @History:
 * @自定义内容：
 */
@RestController
@RequestMapping("/product/categoryBrandRelation")
public class CategoryBrandRelationController {
    @Autowired
    CategoryBrandRelationService relationService;

    @PostMapping("save")
    public Result save(@RequestBody CategoryBrandRelationEntity categoryBrandRelationEntity){
        return relationService.save(categoryBrandRelationEntity);
    }

    @GetMapping("deleteById/{id}")
    public Result deleteById(@PathVariable  Long id){
        return relationService.deleteById(id);
    }

    @GetMapping("findCategoryBrandRelationByBrandId/{brandId}")
    public List<CategoryBrandRelationEntity> findCategoryBrandRelationByBrandId(@PathVariable Long brandId){

        return relationService.findCategoryBrandRelationByBrandId(brandId);
    }
    @GetMapping("findCategoryBrandRelationByCatId/{categoryId}")
    public List<CategoryBrandRelationEntity> findCategoryBrandRelationByCatId(Long categoryId){
        return relationService.findCategoryBrandRelationByCatId(categoryId);
    }
}
